#include "player.h"

Player::Player(QString &name, World *curentWorld)
{
    this->_name = name;
    this->_curentPosition = QPoint(0,0);
    this->_level = 1;
    this->_curentExp = 100;
    this->_eqipment = new Eqip;
    this->_eqipment->_belt = NULL;
    this->_eqipment->_boots = NULL;
    this->_eqipment->_chest = NULL;
    this->_eqipment->_glovles = NULL;
    this->_eqipment->_helemet = NULL;
    this->_eqipment->_pants = NULL;
    this->_eqipment->_weapon = NULL;
    this->_eqipment->_left = NULL;
    this->_world = curentWorld;
}


bool Player::dressOnItem(QString &itemName)
{
    Item *item;
    foreach(item,_invertory)

        if(item->getNames().contains(itemName))
        {
            switch(item->getType())
            {
                case FOOD:
                    this->_log.append("Еду нельзя одеть!");
                    break;
                case MATERIAL:
                    this->_log.append("Матерьял нелзя одеть!");
                    break;
                case WEAPON:
                    this->_eqipment->_weapon = item;
                    this->_log.append("Вы взяли в правую руку " + itemName);
                    break;
                case LEFT:
                    this->_eqipment->_left = item;
                    this->_log.append("Вы взяли в левую руку " + itemName);
                    break;
                case DRINK:
                    this->_log.append("Напиток нельзя одеть!");
                    break;
                case HELEMET:
                    this->_eqipment->_helemet = item;
                    this->_log.append("Вы надели" + itemName);
                    break;
                case GLOVLES:
                    this->_eqipment->_glovles = item;
                    this->_log.append("Вы надели" + itemName);
                    break;
                case BELT:
                    this->_eqipment->_belt = item;
                    this->_log.append("Вы надели" + itemName);
                    break;
                case BOOTS:
                    this->_eqipment->_boots = item;
                    this->_log.append("Вы надели" + itemName);
                    break;
                case PANTS:
                    this->_eqipment->_pants = item;
                    this->_log.append("Вы надели" + itemName);
                    break;
                case CHEST:
                    this->_eqipment->_chest = item;
                    this->_log.append("Вы надели" + itemName);
                    break;
                case QUEST_ITEM:
                    this->_log.append("Квестовый предмет нельзя одеть");
                    break;
                default:
                    break;
            }
      }
}



bool Player::pickUpItem(QString &name)
{

}

bool Player::doSomeCommand(QString &comand)
{
    switch(_world->getCommandId(comand))
    {
        case 1:
            qDebug()<<"Do command 1";
            break;
        case 2:
            qDebug()<<"Do command 2";
            break;
        case 3:
            qDebug()<<"Do command 3";
            break;
        case 4:
            qDebug()<<"Do command 4";
            break;
        case 5:
            qDebug()<<"Do command 5";
            break;
        case 6:
            qDebug()<<"Do command 6";
            break;
        case 7:
            qDebug()<<"Do command 7";
            break;
        default:
            qDebug()<<"Unknown command";
            break;
    }
}

QString Player::getName(void)
{
    return this->_name;
}

QPoint Player::getCurentPos(void)
{
    return this->_curentPosition;
}

int Player::getCurentLevel(void)
{
    return this->_level;
}

int Player::getExp(void)
{
    return this->_curentExp;
}

Eqip* Player::getEqipment(void)
{
    return this->_eqipment;
}
